package net.viralpatel.spring3.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
@Controller
public class HelloWorldController {
 
    @RequestMapping("/hello")
    public ModelAndView helloWorld() {
 
        String message = "Hello World, Spring 3.0!";
        return new ModelAndView("hello", "message", message);
    }
}
	/*
	TAKEN FROM http://viralpatel.net/blogs/spring-3-mvc-create-hello-world-application-spring-3-mvc/
	
	When Spring scans our package, it will recognize this bean as being a Controller bean
	for processing requests. The @RequestMapping annotation tells Spring that this 
	Controller should process all requests beginning with /hello in the URL path. 
	That includes /hello/* and /hello.html.
	
	The helloWorld() method returns ModelAndView object. The ModelAndView object 
	tries to resolve to a view named “hello” and the data model is being passed 
	back to the browser so we can access the data within the JSP. The logical view name 
	will resolve to "/WEB-INF/jsp/hello.jsp". 
	We will discuss this shortly how the logical name “hello” which is return in ModelAndView object is mapped to path /WEB-INF/jsp/hello.jsp.

	The ModelAndView object also contains a message with key “message” and value 
	“Hello World, Spring 3.0!”. This is the data that we are passing to our view. 
	Normally this will be a value object in form of java bean that will contain the 
	data to be displayed on our view. Here we are simply passing a string.
*/
